home *** CD-ROM | disk | FTP | other *** search
- Winsock users,
-
- I have a routine that receives a string, creates a TCP socket, connects it
- to a server and sends the string through the connection. The eculiar thing
- is that at certain times the socket() call returns a descriptor = 0 which
- apparently is not flagged as an INVALID socket. However on attempting to
- send() over a connection through this socket a "descritor not a socket"
- error occurs. The code I am using is as shown below. I am using a
- sockets implementation from sun.
-
- Any suggestions will be highly appreciated.
-
- Please reply via e-mail tw46555@is1.vub.ac.be
-
-
- if((s = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
- sockerror();
- MessageBox(GetActiveWindow(),"Socket open error.\n", "ERROR", MB_ICONSTOP | MB_OK);
- return(entries);
- }
- if(connect(s,(LPSOCKADDR)&sa,sizeof(sa)) == SOCKET_ERROR){
- sockerror();
- MessageBox(GetActiveWindow(),"Socket connect error.\n", "ERROR", MB_ICONSTOP | MB_OK);
- return (entries);
- }
-
- if(send(s,(LPSTR)params,lstrlen((LPCSTR)params),0) == SOCKET_ERROR){ // call server
- sockerror();
- return (entries);
- }
-
-
-
- Thank you in advance.
- Muraya.
-
-